﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;
using System.Diagnostics;

namespace devtm.Editor.Configuration.Customs
{
    public class CustomDescription : INotifyPropertyChanged
    {
        public string Type { get; set; }


        internal void Create(Attribute attr)
        {
            if (attr is System.ComponentModel.TypeConverterAttribute)
            {
                string name = (attr as System.ComponentModel.TypeConverterAttribute).ConverterTypeName;
            
                Debug.Print("->" + name);

            }

        }


        private DateTime _LastUpdate;
        [System.Xml.Serialization.XmlAttribute()]
        public DateTime LastUpdate
        {
            get
            {
                return _LastUpdate;
            }
            set
            {
                if (_LastUpdate == value)
                    return;

                _LastUpdate = value;

                PropertyChange("LastUpdate");
            }
        }

        #region Change
 
        private void PropertyChange(string p)
        {

            if (PropertyChanged != null)
                PropertyChanged(this, new PropertyChangedEventArgs(p));

            if (p != "LastUpdate")
                LastUpdate = DateTime.Now;

        }

        #endregion

        public event PropertyChangedEventHandler PropertyChanged;
    }
}
